<template>
  <div>
    <form action="post">
      电影名：<input type="text" v-model="mname" /><br /><br />
      评分：<input type="text" v-model="score" /><br /><br />
      <!-- 电影海报：<input type="file" v-model="mpic"  /><br /><br /> -->
      时长：<input type="text" v-model="time" /><br /><br />
      详情：<input type="text" v-model="desc" /><br /><br />
      导演：<input type="text" v-model="dire" /><br /><br />
      <!-- 编剧：<input type="text" v-model="writter" /><br /><br />
      演员：<input type="text" v-model="act" /><br /><br />
      类型：<input type="text" v-model="type" /><br /><br />
      地区：<input type="text" v-model="area" /><br /><br />
      语言：<input type="text" v-model="lang" /><br /><br />
      上映时间：<input type="text" v-model="date" /><br /><br />
      标签：<input type="text" v-model="tag" /><br /><br /> -->

      <button @click="submit" type="button">提交</button>
    </form>
  </div>
</template>

<script setup>
import { onMounted, getCurrentInstance, ref } from "vue";
let { proxy } = getCurrentInstance();

let mname = ref("");
let score = ref("");
let mpic = ref("");
let time = ref("");
let desc = ref("");
let dire = ref("");
// let writter = ref("");
// let act = ref("");
// let type = ref("");
// let area = ref("");
// let lang = ref("");
// let date = ref("");
// let tag = ref("");


let submit = async () => {
  let arg = new FormData();
  arg.append("mname", mname.value);
  arg.append("score", score.value);
  arg.append('mpic',mpic.value);
  arg.append("time", time.value);
  arg.append("desc", desc.value);
  arg.append("dire", dire.value);
  // arg.append("writter", writter.value);
  // arg.append("act", act.value);
  // arg.append("type", type.value);
  // arg.append("area", area.value);
  // arg.append("lang", lang.value);
  // arg.append("date", date.value);
  // arg.append("tag", tag.value);

  // console.log(arg.get('mname'))
  let res = await proxy.$axios.post("/dj/add", arg);
  console.log(res);
};
</script>

<style>
</style>